package org.cshoo.common.business
{
	
	import hessian.client.HessianService;
	
	public class ServiceLocator
	{
		
		private static var instance:ServiceLocator;
		
		public var dictionaryService:HessianService;
		
		public var menuService:HessianService;
		
		public var organizationService:HessianService;
		
		public var parameterService:HessianService;
		
		public var authorityService:HessianService;
		
		public var roleService:HessianService;
		
		public var userService:HessianService;
		
		public static function getInstance():ServiceLocator
		{
			if(instance==null)	instance = new ServiceLocator();
			return instance;
		}
		
		public function ServiceLocator()
		{
			if(instance!=null) throw new Error("Error: Singletons can only be instantiated via getInstance() method!");
			
			dictionaryService = new HessianService("dictionaryService");
			dictionaryService.destination = "../spring/dictionaryService";
			
			menuService = new HessianService("menuService");
			menuService.destination = "../spring/menuService";
			
			organizationService = new HessianService("organizationService");
			organizationService.destination = "../spring/organizationService";
			
			parameterService = new HessianService("parameterService");
			parameterService.destination = "../spring/parameterService";
			
			authorityService = new HessianService("authorityService");
			authorityService.destination = "../spring/authorityService";
			
			roleService = new HessianService("roleService");
			roleService.destination = "../spring/roleService";
			
			userService = new HessianService("userService");
			userService.destination = "../spring/userService";
			
			ServiceLocator.instance = this;
		}
	}
}